import { loadLocaleMessages } from '@/i18n'
import { ActionContext } from 'vuex'
import { RootGetters } from './getters'
import { RootStateOptions } from './state'

interface NewAC extends ActionContext<RootStateOptions, RootStateOptions> {
  getters: RootGetters
  rootGetters: RootGetters
}
export default {
  /**
   * @description 切换语言
   */
  changeLang (options:NewAC, lang: string):void {
    loadLocaleMessages(lang).then(() => {
      options.commit('setLangCode', lang)
    })
  }
}
